<%@ page language="java"  
    import ="com.jju.A1541.model.*"
    import ="com.jju.A1541.dao.*"
    contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
  <%
       //1.获得表单的输入
       String ly = request.getParameter("ly");
       String uname =(String)session.getAttribute("uname");
       String ejxy =(String)session.getAttribute("ejxy");
       
       ly= new String(ly.getBytes("ISO-8859-1"),"UTF-8");
       //2.创建Ly实体类Ly对象并进行赋值
         Ly  obj = new	Ly();
         obj.setUname(uname);
         obj.setEjxy(ejxy);
         obj.setLy(ly);
       //3.调用LyDAO完成实体对象的持久化--保存到数据库表中
       int n1 = LyDAO.add1(obj);
       
       //4..对结果的处理
        if( n1>0){
        	request.getSession().setAttribute("ly", ly);
        	out.print("<script>alert('留言成功！'); window.location='index.jsp'  </script>");
        }else{
        	   out.println("保存失败!");
        }
       %>